from home import models
from rest_framework.serializers import ModelSerializer
# 导航序列化
class NavSer(ModelSerializer):
    class Meta:
        model =models.NavModel
        fields = '__all__'

# benner序列化
class BannerSer(ModelSerializer):
    class Meta:
        model =models.BannerModel
        fields = '__all__'

# category 分类序列化 因为有父级，要进行改动
class Category(ModelSerializer):
    class Meta:
        model =models.CategoryModel
        fields = ['id','catename']

class CategorySer(ModelSerializer):
    children = Category(many=True)
    class Meta:
        model =models.CategoryModel
        fields = '__all__'